import style from "./home.css";
import { connect } from "dva";
import Link from "umi/link";
import { Button,Form, Icon, Input,Layout,Menu,message,Avatar, BackTop} from "antd";
const { Header, Content, Footer, Sider } = Layout;
const { SubMenu } = Menu;

function Home(props) {
	const FormItem = Form.Item;
	const success = () => {
	  message.success('退出成功~');
	  // localStorage.removeItem('token',props.token);
	  // props.history.push("/")
	};
	
  return (
    <div>
    	<Layout>
    	    <Sider
    	      breakpoint="lg"
    	      collapsedWidth="0"
    	      onBreakpoint={broken => {
    	        console.log(broken);
    	      }}
    	      onCollapse={(collapsed, type) => {
    	        console.log(collapsed, type);
    	      }}
    	    >
				
    	      <div className="logo" />
    	      <Menu theme="dark" mode="inline" defaultSelectedKeys={['1']}>
    	        <p style={{ margin: 20,height:50,width:1 }}></p>
				<SubMenu
				   key="sub1"
				     title={
				       <span>
				         <Icon type="user" />
				         <span>用户管理</span>
				       </span>
				     }
				   >
				     <Menu.Item key="1"><Link to="/home/userList">用户列表</Link></Menu.Item>
				     <Menu.Item key="2"><Link to="/home/addUser">用户添加</Link></Menu.Item>
				   </SubMenu>
				<SubMenu
				   key="sub2"
				     title={
				       <span>
				         <Icon type="video-camera" />
				         <span>商品管理</span>
				       </span>
				     }
				   >
				     <Menu.Item key="3"><Link to="/home/productList">商品列表</Link></Menu.Item>
				     <Menu.Item key="4"><Link to="/home/addProduct">商品添加</Link></Menu.Item>
					 <Menu.Item key="5"><Link to="/home/fenlei">商品分类</Link></Menu.Item>
				   </SubMenu>
    	        <SubMenu
    	           key="sub3"
    	             title={
    	               <span>
    	                 <Icon type="team" />
    	                 <span>订单列表</span>
    	               </span>
    	             }
    	           >
    	             <Menu.Item key="6"><Link to="/home/oderList">订单列表</Link></Menu.Item>
    	           </SubMenu>
				</Menu>
    	    </Sider>
    	    <Layout>
    	      <Header style={{ background: '#fff', padding: 0,position:'relative'}} >
				<Avatar style={{ color: '#f56a00', backgroundColor: '#fde3cf',position:'absolute',right:110,top:15 }}>Admin</Avatar>
				<Link to="/"> 
					<p style={{position:'absolute',right:40,top:0,color:'#333'}} onClick={success}>退出登录</p>
				</Link>	
			  </Header>
    	      <Content style={{ margin: '24px 16px 0' }}>
    	        <div style={{ padding: 24, background: '#fff', minHeight: 600 }}>
				
				{props.children}
				</div>
    	      </Content>
    	      <Footer style={{ textAlign: 'center' }}>富邦美喆家居</Footer>
    	    </Layout>
    	  </Layout>
		  <BackTop/>
    </div>
  );
}

export default Home
